package implementor;

import java.sql.SQLException;

import dao.IndentItemsDao;
import dbhandelling.Crude;
import dto.IndentItems;
import dto.Indents;


public class IndentItemsImpl extends Crude implements IndentItemsDao{

	String className=new IndentItems().getClass().getName();
	@Override
	public void add(IndentItems items) throws SQLException, Exception {
		super.insert(items);
		
	}

	@Override
	public void update(IndentItems items) throws Exception {
		super.update(className, "mCode", items.getmCode()+"", "autoIndentItems", items.getAutoIndentItems()+"");
		super.update(className, "requiredQty", items.getRequiredQty()+"", "autoIndentItems", items.getAutoIndentItems()+"");
		super.update(className, "specCode", items.getSpecCode()+"", "autoIndentItems", items.getAutoIndentItems()+"");
		super.update(className, "indentNo", items.getindentId()+"", "autoIndentItems", items.getAutoIndentItems()+"");
		
	}

	@Override
	public void delete(IndentItems items) throws Exception {
		super.delete(className,"autoIndentItems", items.getAutoIndentItems()+"" );
		
	}

	@Override
	public IndentItems retreive(String conditionField, String ConditionValue)
			throws Exception {
		IndentItems i=(IndentItems) super.retreive(className, conditionField, ConditionValue);
		return i;
	}

	@Override
	public IndentItems[] retreiveArray(String conditionField,
			String ConditionValue) throws Exception {
		Object[] ind= super.retreiveArrayOnCondition(className, conditionField, ConditionValue);
		IndentItems[] s=new IndentItems[ind.length];
		
		for(int i=0;i<s.length;i++)
			s[i]=(IndentItems) ind[i];
		return s;
	}

	@Override
	public IndentItems[] retreiveAll() throws Exception {
		Object[] ind= super.retreiveAll(className);
		IndentItems[] s=new IndentItems[ind.length];
		
		for(int i=0;i<s.length;i++)
			s[i]=(IndentItems) ind[i];
		return s;
	}

   public IndentItems[] retriveModelOnIndentNumber(int indentNo)
   {
	
	   return null;
	   
   }



}
